package com.wunong.smart.collection.application.context;

import com.wunong.smart.collection.application.request.BaseCollectionRequest;
import com.wunong.smart.collection.domain.model.CollectionDomain;
import lombok.Data;

/**
 * @author create by zealot.zt
 */
@Data
public class CollectionContext<REQUEST extends BaseCollectionRequest> {

    /**
     * 请求对象
     */
    private REQUEST request;

    /**
     * 模型对象
     */
    private CollectionDomain domain;

    /**
     * 业务数据信息
     */
    private Object bizData;

    public static <REQUEST extends BaseCollectionRequest> CollectionContext<REQUEST> of(REQUEST request, CollectionDomain domain) {
        CollectionContext<REQUEST> context = CollectionContext.of(request);
        context.setDomain(domain);
        return context;
    }

    public static <REQUEST extends BaseCollectionRequest> CollectionContext<REQUEST> of(REQUEST request) {
        CollectionContext<REQUEST> context = new CollectionContext<>();
        context.setRequest(request);
        return context;
    }

}
